package com.qf.collection.generic;

import com.qf.collection.Animal;
import com.qf.collection.Cat;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;

public class Demo01 {
    public static void main(String[] args) {
        Collection<String> c1 = new ArrayList<String>();
        c1.add("hello");
        c1.add("world");

        Iterator<String> iterator = c1.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            System.out.println(s.toUpperCase(Locale.ROOT));
        }

        System.out.println(c1);

        ArrayList<Object> c2 = new ArrayList<>();
        c2.add(new Cat());
        c2.add(new Animal());
        Iterator<Object> iterator1 = c2.iterator();
        while (iterator1.hasNext()) {
            Object next = iterator1.next();

            if (next instanceof Cat){

            }
        }
    }
}
